package com.java.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.java.dao.SparePartsFlowDao;
import com.java.entity.SparePartsFlow;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;

/**
 * 备件流水(SparePartsFlow)表控制层
 *
 * @author 安能
 * @since 2020-07-01 11:28:05
 */
@RestController
@RequestMapping("SparePartsFlow")
public class SparePartsFlowController {


    @Resource
    private SparePartsFlowDao sparePartsFlowDao;



    @GetMapping("selectList")
    public HashMap<String, Object> selectList(Integer type) {
        List<SparePartsFlow> sparePartsFlows = sparePartsFlowDao.selectList(new QueryWrapper<SparePartsFlow>().eq("type",type));
        HashMap<String, Object> map = new HashMap<>();
        map.put("code", 0);
        map.put("msg", "");
        map.put("count", sparePartsFlows.size());
        map.put("data", sparePartsFlows);
        return map;
    }

}